<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>欢迎注册</title>
    <!-- <link href="css/register.css" rel="stylesheet"> -->
    <link rel="stylesheet" href="../../style/login/register.css">
    <script type="text/javascript" src="../../plugins/axios/axios.js"></script>
    <script type="text/javascript" src="../../plugins/vue/vue.js"></script>
    <script type="text/javascript" src="../../plugins/jQuery/jquery-3.6.0.js"></script>
    <script type="text/javascript" src="../../plugins/layer-master/dist/layer.js"></script>

    <link rel="stylesheet" href="../../plugins/element-ui/index.css">
    <!-- 引入组件库 -->
    <script src="../../plugins/element-ui/index.js"></script>
</head>
<body>
<div id="app">
    <div class="form-div">
        <div class="reg-content">
            <h1>欢迎挂号</h1>
            <span>医生？</span> <a href="yszc.html">注册</a>
        </div>
        <form id="reg-form" action="#" method="post">

            <table>
                <tr>
                    <td>用户名</td>
                    <td class="inputs">
                        <input name="binXingming" type="text" id="binXingming" v-model="binXingming">
                    </td>
                </tr>

                <tr>
                    <td>性别</td>
                    <td class="inputs">
                        <input name="binXingbie" type="text" id="binXingbie" v-model="binXingbie">
                    </td>
                </tr>
                <tr>
                    <td>年龄</td>
                    <td class="inputs">
                        <input name="binNianling" type="text" id="binNianling" v-model="binNianling">
                    </td>
                </tr>
                <tr>
                    <td>身份证号</td>
                    <td class="inputs">
                        <input name="binShenfenzheng" type="text" id="binShenfenzheng" v-model="binShenfenzheng">
                    </td>
                </tr>
                <tr>
                    <td>手机号</td>
                    <td class="inputs">
                        <input name="binShoujihao" type="password" id="binShoujihao" v-model="binShoujihao">
                    </td>
                </tr>

                <tr>
                    <td>科室</td>
                    <td class="inputs">
                        <input name="binKeshi" type="text" id="binKeshi" v-model="binKeshi">
                    </td>
                </tr>
            </table>
            <div class="buttons">
                <input value="挂 号" type="button" id="reg_btn" @click="registerIn">
            </div>
            <br class="clear">
        </form>
    </div>
</div>


</body>
</html>
<script>
    new Vue({
        el: "#app",
        date: {
            binXingming: '',
            binXingbie: '',
            binShenfenzheng: '',
            binNianling: '',
            binShoujihao: '',
            binKeshi: ''
        },
        methods: {
            registerIn() {
                axios({
                    url: 'http://localhost:8899/bingr/guahao',
                    method: 'get',
                    params: {
                        binXingming: this.binXingming,
                        binXingbie: this.binXingbie,
                        binShenfenzheng: this.binShenfenzheng,
                        binNianling: this.binNianling,
                        binShoujihao: this.binShoujihao,
                        binKeshi: this.binKeshi
                    }
                }).then(resp => {
                    let result = resp.data
                    if (result.success) {
                        localStorage.setItem('id', resp.data)
                        location.href = '../../zifu.html'
                        return;
                    }
                    this.error = result.error
                    })
                }
        }
    })

</script>